﻿<%@ Page Language="C#" %>
<%@ Register TagPrefix="dsweb" Namespace="DaveSexton.Web.Controls" Assembly="DaveSexton.AutoInputProtection" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
  void Page_Load()
  {
    if (Page.IsPostBack)
    {
      Page.Validate();

      if (Page.IsValid)
        protectedResource.Visible = true;
    }
  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>AIP Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <dsweb:AutoInputProtectionControl runat="server" ID="aip" RequestKeepAlive="true" ValidationKeepAlive="true">
        <Template>
          <asp:Image runat="server" ID="Image" />
          <br />
          Enter the text from the image: <br />
          <asp:TextBox runat="server" ID="Text" />
          <asp:RequiredFieldValidator runat="server" ID="RequiredValidator" ControlToValidate="Text" Display="Dynamic" />
          <asp:CustomValidator runat="server" ID="Validator" ControlToValidate="Text" Display="Dynamic" />
        </Template>
      </dsweb:AutoInputProtectionControl>

      <asp:Button runat="server" ID="submitButton" Text="Submit" />
      
      <br /><asp:Label runat="server" ID="protectedResource" BackColor="Red" Visible="false">This is a protected resource.</asp:Label>
      
      <asp:ValidationSummary runat="server" ID="summary" />
    </form>
</body>
</html>